//
//  Api.swift
//  FireBOOM
//
//  Created by ktiays on 2020/7/22.
//

import Foundation
import Alamofire

class Api {
    
    private static let BASE_URL = "http://39.97.229.6:8080/fireWarningSystem"
    
    public static func newUser() {
        AF.request(BASE_URL + "/newUser", method: .post).responseString { _ in return }
    }
    
    public static func upload(id: String, temperature: Int, conc: Int, detected: Int) {
        AF.request(BASE_URL + "/uploadData",
                   method: .post,
                   parameters: ["userID": id,
                                "Temperature": temperature,
                                "Smokeconc": conc,
                                "flameDetected": detected,
                                "timestamp": Int(Date().timeIntervalSince1970)])
            .responseString { _ in return }
    }
}
